<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        var  str = 'abcdacbabcbababcbabcabd';
        
        var arr=str.split("");
      var nn=  arr.reduce(function(pre,cur){

             if(cur in pre ){
                 pre[cur] += 1;

             }else {
                 pre[cur] = +1
             }
                return pre
        },{})
  
      for(var i in nn){
          console.log(i+":"+nn[i])
      }

    </script>
</body>
</html>